package com.study.happystudy.service.impl;

import com.study.happystudy.mapper.ActivityMapper;
import com.study.happystudy.po.Activity;
import com.study.happystudy.po.User;
import com.study.happystudy.service.ActivityService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ActivityServiceImpl implements ActivityService {
    @Resource
    ActivityMapper activityMapper;

    @Override
    public void addActivity(String title, String imageUrl, String content, String startTime, String endTime) {
        activityMapper.addActivity(title, imageUrl, content, startTime, endTime);
    }

    @Override
    public void deleteActivityById(int activityId) {
        activityMapper.deleteActivityById(activityId);
    }

    @Override
    public void updateActivity( String title, String imageUrl, String content, String startTime, String endTime, int activityId) {
        activityMapper.updateActivity(title, imageUrl, content, startTime, endTime,activityId);
    }

    @Override
    public Activity getActivityById(int activityId) {
        return activityMapper.getActivityById(activityId);
    }

    @Override
    public List<User> getUsersByActivityId(int activityId) {
        return activityMapper.getUsersByActivityId(activityId);
    }

    @Override
    public List<Activity> getAllActivities() {
        return activityMapper.getAllActivities();
    }

    @Override
    public List<Activity> getUnstartedActivities() {
        return activityMapper.getUnstartedActivities();
    }

    @Override
    public List<Activity> getOngoingActivities() {
        return activityMapper.getOngoingActivities();
    }

    @Override
    public List<Activity> getFinishedActivities() {
        return activityMapper.getFinishedActivities();
    }

    @Override
    public Integer isUserInActivity(int userId, int activityId) {
        return activityMapper.isUserInActivity(userId, activityId);
    }
    public void addUserToActivity(int userId, int activityId){
        activityMapper.addUserToActivity(userId, activityId);
    }
}
